﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Web.Models.ViewModels
{
    public class AdminRegisterViewModel
    {
        [DisplayName("登录名")]
        [Required]
        [MaxLength(20)]
        public string UserName { get; set; }

        [DisplayName("真实姓名")]
        [Required]
        [StringLength(10)]
        public string RealName { get; set; }

        [DisplayName("密码")]
        [Required(ErrorMessage = "请输入{0}")]
        [StringLength(20, MinimumLength = 6)]
        [DataType(DataType.Password)]

        public string Password { get; set; }

        [Display(Name = "确认密码")]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessage = "密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }
    }

    public class AdminEditViewModel
    {
        public Guid Id { get; set; }

        [DisplayName("登录名")]
        [Required]
        [MaxLength(20)]
        public string UserName { get; set; }

        [DisplayName("真实姓名")]
        [Required]
        [StringLength(10)]
        public string RealName { get; set; }

        [DisplayName("密码")]
        [StringLength(20, MinimumLength = 6)]
        [DataType(DataType.Password)]

        public string Password { get; set; }

        [Display(Name = "确认密码")]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessage = "密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }
    }
}
